package com.ynny.demo14.Service;

import com.ynny.demo14.entity.R;
import com.ynny.demo14.entity.user;
import com.ynny.demo14.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public List<user> selectAll() {
        return userMapper.selectAll();
    }

    @Override
    public R login(String username, String password) {
        if (username == null || password == null)
            return R.error(400,"用户名或密码为空");
        if (userMapper.selectByusername(username).size() == 0)
            return R.error(400,"用户名不存在");

        else
            return R.ok(200);


    }

}
